package com.bwie.test;


import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.bwie.vo.OrderVo;

/**
 * @author 上杉绘梨衣 && Sakura
 * @Yu 我们都是小怪兽，总有一天会被正义的奥特曼杀死。
 * @Yu "不知道从什么时候,我开始不喜欢社交，沉浸在自己的小圈子里"
 * @date 2025/9/14-18:52
 */

public class Main {
    public static void main(String[] args) {
      String url = "http://127.0.0.1:9023/pay/index/payOrder";

        OrderVo orderVo =
                OrderVo.builder()
                        .orderId("24314342").build();

        HttpRequest post = HttpRequest.post(url);
        HttpResponse response = post.header("Content-Type", "application/json")
                .body(JSON.toJSONString(orderVo))
                .execute();
        System.out.println(response.body());

    }

    public static void test1() {
        String url = "http://127.0.0.1:9023/"+"/pay/index/user";

        JSONObject response = new JSONObject();
        response.set("id", "1001L");
        response.set("name", "测试用户1");
        response.set("email", "3591471857@qq.com");
        response.set("age", 20);

        HttpResponse request = HttpRequest.post(url)
                .header("Content-Type", "application/json")
                .body(response.toString())
                .timeout(5000)
                .execute();

        System.out.println("request"+ JSONUtil.toJsonStr(request));
    }
    public static void test2() {
        String url = "http://127.0.0.1:9023/"+"/pay/index/user2";
        OrderVo order = OrderVo.builder()
                .userId("11111")
                .price(23.23)
                .orderId("Shenxinxi05")
                .build();
        HttpResponse httpResponse = HttpRequest.post(url)
                .header("Content-Type", "application/json")
                .body(JSON.toJSONString(order))
                .timeout(5000)
                .execute();
        System.out.println("httpResponse"+ JSONUtil.toJsonStr(httpResponse));

    }


}
